//
//  JSBaseTableViewCell.h
//  NiubilityProject
//
//  Created by Apple on 2018/3/29.
//  Copyright © 2018年 Apple. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "JSCellDataAdapter.h"

@class JSBaseTableViewCell;

@protocol JSBaseCellDelegate <NSObject>

@optional
/*!
 *  BABaseCell 的事件处理
 *
 *  @param cell   BABaseCell type class
 *  @param action action
 */
- (void)ba_customCell:(JSBaseTableViewCell *)cell action:(id)action;

@end

@interface JSBaseTableViewCell : UITableViewCell

@property (nonatomic, weak) id <JSBaseCellDelegate>   delegate;
@property (nonatomic, weak) JSCellDataAdapter        *dataAdapter;
@property (nonatomic, weak) id                        data;
@property (nonatomic, weak) NSIndexPath              *indexPath;
@property (nonatomic, weak) UITableView              *tableView;
@property (nonatomic, weak) UIViewController         *controller;
@property (nonatomic      ) BOOL                      displayCell;


- (void)js_setupCell;

- (void)js_buildSubview;

- (void)js_loadContent;

+ (JSCellDataAdapter *)js_dataAdapterWithCellReuseIdentifier:(NSString *)reuseIdentifier
                                                        data:(id)data
                                                  cellHeight:(CGFloat)height
                                                        type:(NSInteger)type;

- (void)js_setWeakReferenceWithCellDataAdapter:(JSCellDataAdapter *)dataAdapter
                                          data:(id)data
                                     indexPath:(NSIndexPath *)indexPath
                                     tableView:(UITableView *)tableView;

- (void)js_selectedEvent;

- (void)js_updateWithNewCellHeight:(CGFloat)height
                          animated:(BOOL)animated;


@end
